package bean;

import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import java.util.Date;
import java.util.Objects;

/**
 * 用户表
 */
public class Users {

    //UID
    private String userId;

    //用户名
    @NotBlank
    @Length(max = 30, min = 2)
    private String userName;

    //手机号码
    @NotBlank
    @Length(min = 11, max = 11)
    private String phone;

    //地址
    private String address;

    //性别
    @NotBlank
    @Pattern(regexp = "^[男]||[女]$")
    private String sex;

    //出生时间
    private Date brithday;

    //邮箱
    private String email;

    //头像
    private String avatar;

    //状态码
    private String status = "0";

    //创建时间
    private Date createTime;

    //微博ID
    private String weiboId;

    //QQ_ID
    private String qq;

    //对应token标识
    private String identification;

    //密码
    @NotBlank
    @Length(min = 6, max = 20)
    private String password;

    //简介
    private String reamk;

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId == null ? null : userId.trim();
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName == null ? null : userName.trim();
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone == null ? null : phone.trim();
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address == null ? null : address.trim();
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex == null ? null : sex.trim();
    }

    public Date getBrithday() {
        return brithday;
    }

    public void setBrithday(Date brithday) {
        this.brithday = brithday;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email == null ? null : email.trim();
    }

    public String getAvatar() {
        return avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar == null ? null : avatar.trim();
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status == null ? null : status.trim();
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }


    public String getWeiboId() {
        return weiboId;
    }

    public void setWeiboId(String weiboId) {
        this.weiboId = weiboId == null ? null : weiboId.trim();
    }

    public String getQq() {
        return qq;
    }

    public void setQq(String qq) {
        this.qq = qq == null ? null : qq.trim();
    }

    public String getIdentification() {
        return identification;
    }

    public void setIdentification(String identification) {
        this.identification = identification == null ? null : identification.trim();
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password == null ? null : password.trim();
    }

    public String getReamk() {
        return reamk;
    }

    public void setReamk(String reamk) {
        this.reamk = reamk;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Users users = (Users) o;
        return Objects.equals(userId, users.userId) &&
                Objects.equals(userName, users.userName) &&
                Objects.equals(phone, users.phone) &&
                Objects.equals(address, users.address) &&
                Objects.equals(sex, users.sex) &&
                Objects.equals(brithday, users.brithday) &&
                Objects.equals(email, users.email) &&
                Objects.equals(avatar, users.avatar) &&
                Objects.equals(status, users.status) &&
                Objects.equals(createTime, users.createTime) &&
                Objects.equals(weiboId, users.weiboId) &&
                Objects.equals(qq, users.qq) &&
                Objects.equals(identification, users.identification) &&
                Objects.equals(password, users.password) &&
                Objects.equals(reamk, users.reamk);
    }

    @Override
    public int hashCode() {
        return Objects.hash(userId, userName, phone, address, sex, brithday, email, avatar, status, createTime, weiboId, qq, identification, password, reamk);
    }

    @Override
    public String toString() {
        return "Users{" +
                "userId='" + userId + '\'' +
                ", userName='" + userName + '\'' +
                ", phone='" + phone + '\'' +
                ", address='" + address + '\'' +
                ", sex='" + sex + '\'' +
                ", brithday=" + brithday +
                ", email='" + email + '\'' +
                ", avatar='" + avatar + '\'' +
                ", status='" + status + '\'' +
                ", createTime=" + createTime +
                ", weiboId='" + weiboId + '\'' +
                ", qq='" + qq + '\'' +
                ", identification='" + identification + '\'' +
                ", password='" + password + '\'' +
                ", reamk='" + reamk + '\'' +
                '}';
    }
}